#include <stdio.h>
#include <conio.h>
#include <math.h>

double dydx(double);
double dzdx(double, double);
void EilerSolver(double, double, double, double, double);
void main()
{
  EilerSolver(0,10,0,0.8,0.1);
  getch();
};
double dydx(double y)
{
  return -0.5*y;
};
double dzdx(double x, double y)
{
  return 0.5*y-0.2*x;
};
void EilerSolver(double x0,double y0,double z0,double xn,double h)
{double x,y,z,y1; int n,i;
  x=x0;
  y=y1=y0;
  z=z0;
  n=(xn-x)/h;
  for (i=0; i<=n-1; i++)
  {
    y=y+h*dydx(y);
    z=z+h*dzdx(x,y1);
    y1=y;
    x=x+h;
  };
  printf("\nSolved value Y=%g\nSolved Value Z=%g",y,z);
};
